var _inherit = require('core/inherit.js');
var _Container = require('component/container.js');
var _layout = require('tools/layout.js');
var _relative = _layout.relative;

var _Constance = require('./constance.js');
var _global = require('global/global.js');
var S = require('res/style.js');
var _Utility = require('scenes/utility.js');

// ==========================
// TotalScore
// ==========================
function TotalScore() {
    _Container.call(this);
    this.setId('score');

    this.addChild(this.mScore = S.game.header.score.createText('0'));
    this.mScore.setAnchor(0.5, 0.5);

    this.layout();
}
_inherit(TotalScore, _Container);
TotalScore.prototype.layout = function () {
    this.setSize(_Constance.headerSize);
    _relative.local.layoutTo(this.mScore, 0.5, 0.5, this, 0.5, 0.5);
};
TotalScore.prototype.updateScore = function (score) {
    this.mScore.setText(_Utility.numberFormat(score));
};

module.exports = TotalScore;